package cn.iocoder.yudao.module.wms.dal.mysql.location;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.wms.controller.admin.location.vo.LocationPageReqVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.location.LocationDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 货位档案 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LocationMapper extends BaseMapperX<LocationDO> {

    default PageResult<LocationDO> selectPage(LocationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LocationDO>()
                .likeIfPresent(LocationDO::getCode, reqVO.getCode())
                .likeIfPresent(LocationDO::getName, reqVO.getName())
                .orderByDesc(LocationDO::getId));
    }

    List<LocationDO> selectListByWarehouse(@Param("inventoryId") Long inventoryId, @Param("warehouseId") String warehouseId);

}